package com.example.test.mapper;

import com.example.test.entity.Message;
import com.example.test.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Mapper
@Transactional
public interface MessageMapper {

@Select("select text from message where from =#{from}  and to = #{to}")
  public boolean findByName(String from,String to);

@Insert("insert into message values(#{from},#{text},#{to},#{id})")
public Boolean InsertMessage(String from,String text,String to,Integer id);

@Select("select * from message")
  List<Message> getMessage();
@Select("select from,to from message")
  List<Message> getMessagesBetween(@PathVariable String from, @PathVariable String to);
}
